import { getApiData } from "../../tools/HttpClient";
// 获取指定账套ID的科目的节点的上级节点
export async function getSubjectParentList(params) {
    const res = await getApiData("account.subject.getDataParentList", params);
    return Promise.resolve({
        data: res.data,
        success: res.ok,
    });
}
// 获取左侧切换的数据
export async function getSubjectType(params) {
    const res = await getApiData("account.subject.getType", params);
    if (res.ok) {
        return res.data;
    }
    return {};
}
// 获取右侧表格数据
// account.subjectSDB.getDataList
export async function getSubjectSDB(params) {
    const res = await getApiData("account.subjectSDB.getDataList", params);
    // if (res.ok) {
    //   return res.data;
    // }
    // return {};
    if (res.ok) {
        return Promise.resolve({
            data: res.data,
            success: true,
        });
    }
    return Promise.resolve({
        data: [],
        success: false,
    });
}
// 获取辅助账的核算项目类型
export async function AssistgetType(params) {
    const res = await getApiData("account.assist.getType", params);
    if (res.ok) {
        return res.data;
    }
    return [];
}
// 获取科目是否存在辅助账
export async function SubjectIsHasFZZ(params) {
    const res = await getApiData("account.subject.isHasFZZ", params);
    if (res.ok)
        return res.data;
}
// 是否可以增加辅助账
export async function IsCanAddFZZ(params) {
    const res = await getApiData("account.subject.isCanAddFZZ", params);
    if (res.ok)
        return res.data;
}
// 自动增加下级辅助账
export async function AutoAddChildrenForFZZ(params) {
    const res = await getApiData("account.subject.autoAddChildrenForFZZ", params);
    if (res.ok)
        return res.data;
}
// 获取一个当前科目 自动增加第一个子科目
// account.subject.autoAddFirstChildren
export async function autoAddFirstChildren(params) {
    const res = await getApiData("account.subject.autoAddFirstChildren", params);
    if (res.ok) {
        return res;
    }
    else {
        return res;
    }
}
// 获取一个新科目编号
export async function getNewKMBH(params) {
    const res = await getApiData("account.subject.getNewKMBH", params);
    if (res.ok) {
        return res;
    }
    else {
        return res;
    }
}
// 增加辅助账
export async function AssistAdd(params) {
    const res = await getApiData("account.assist.add", params);
    return res;
}
// 编辑辅助账
export async function AssistEdit(params) {
    const res = await getApiData("account.assist.edit", params);
    if (res.ok)
        return res.ok;
}
// 删除辅助账
export async function AssistDel(params) {
    const res = await getApiData("account.assist.del", params);
    if (res.ok) {
        return res;
    }
    else {
        return res;
    }
}
// 获取账套
export async function getAccountInfo(params) {
    if (!params.dbname)
        return [];
    const res = await getApiData("account.accountInfo.getDataList", params);
    return Promise.resolve({
        data: res.data,
        success: res.ok,
    });
}
